package stmo.栈;


/**
 *   栈测试类
 */

public class StackTest {

    public static void main(String[] args) {

        Stack<String> stack = new Stack<>();
        stack.push("撒啊");
        stack.push("科技");
        stack.push("弄撒");
        stack.push("菜鸟");

        for (String s : stack) {
            System.out.println(s);
        }

        System.out.println("-----------");
        Object pop = stack.pop();
        System.out.println(pop);
        Object pop2 = stack.pop();
        System.out.println(pop2);

        System.out.println("-----------");
        System.out.println("剩余元素个数："+stack.size());
        for (String s : stack) {
            System.out.println(s);
        }
    }
}
